package cn.easyar.samples.helloarqrcode;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.easyar.samples.helloarqrcode.adpter.RoadAdapter;

public class RouteActivity extends AppCompatActivity {

    @BindView(R.id.rv_route_list)
    RecyclerView rvRouteList;
    private List<String> mRuteList = new ArrayList<String>();
    private Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_route);
        context = this;
        ButterKnife.bind(this);
        initData();
        RoadAdapter roadAdapter = new RoadAdapter(mRuteList);
        rvRouteList.setLayoutManager(new LinearLayoutManager(this));
        rvRouteList.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));
        rvRouteList.setAdapter(roadAdapter);
        roadAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Intent it = new Intent(context, MainActivity.class);
                startActivity(it);
            }
        });
    }

    private void initData() {
        mRuteList.add("脱硫装置巡检");
    }
}
